<%--
  Created by IntelliJ IDEA.
  User: root
  Date: 2021/2/24
  Time: 14:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="public/head.jsp" %>
<div class="container" style="width: 500px;margin-top: 200px;">
    <form class="form-horizontal " >
        <div class="form-group text-center">
            <H1>后台管理系统</H1>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">账户</label>
            <div class="col-sm-10">
                <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
            <div class="col-sm-10">
                <input type="password" class="form-control" id="inputPassword3" placeholder="Password">
            </div>
        </div>
<%--        <div class="form-group">--%>
<%--            <div class="col-sm-offset-2 col-sm-10">--%>
<%--                <div class="checkbox">--%>
<%--                    <label>--%>
<%--                        <input type="checkbox"> Remember me--%>
<%--                    </label>--%>
<%--                </div>--%>
<%--            </div>--%>
<%--        </div>--%>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="button" class="btn btn-default submitLogin">登录</button>
            </div>
        </div>
        <script type="application/javascript">
            $(function () {
                $(".submitLogin").bind("click",function(){
                    var username_val = $("#inputEmail3").val();
                    if( username_val.trim() == "" ){
                        layer.msg('请输入登录账户',{time: 1000});
                        return;
                    }
                    var password_val = $("#inputPassword3").val();
                    if( password_val.trim() == "" ){
                        layer.msg('请输入登录密码',{time: 1000});
                        return;
                    }
                    var admin={username1:username_val,password1:password_val};
                    var jsonData = JSON.stringify(admin);
                    $.ajax({
                        contentType :"application/json;charset=utf-8",
                        url:basePath+"adminLogin",
                        data:jsonData,
                        dataType:"JSON",
                        type:"post",
                        success:function( res ){
                            if( res.code != 200 ){
                                layer.msg( res.message , {time: 1000} );
                            }else{
                                window.location.href = basePath+"manage";
                            }
                        }
                    });

                });
            })
        </script>
    </form>
</div>
<%@ include file="public/footer.jsp" %>